{% extends "dappx/base.html" %}
{% block body_block %}
<br>
<div class="container">
  <div class="jumbotron">
    <h4>Post a log file to start analyze!</h4>


<form method="POST" action="#" enctype="multipart/form-data">
   {% csrf_token %}
    <!-- COMPONENT START -->
    <div class="form-group">
        <div class="input-group input-file" name="Fichier1">
            <input type="text" class="form-control" placeholder='Choose a file...' />            
            <span class="input-group-btn">
                <button class="btn btn-default btn-choose" type="button">Choose</button>
            </span>
        </div>
    </div>
    <!-- COMPONENT END -->
    <div class="form-group">
        <button type="submit" class="btn btn-primary pull-right" >Submit</button>
        <button type="reset" class="btn btn-danger">Reset</button>
    </div>
</form>


  </div>

</div>
<script>
function bs_input_file() {
    $(".input-file").before(
        function() {
            if ( ! $(this).prev().hasClass('input-ghost') ) {
                var element = $("<input type='file' class='input-ghost' style='visibility:hidden; height:0'>");
                element.attr("name",$(this).attr("name"));
                element.change(function(){
                    element.next(element).find('input').val((element.val()).split('\\').pop());
                });
                $(this).find("button.btn-choose").click(function(){
                    element.click();
                });
                $(this).find("button.btn-reset").click(function(){
                    element.val(null);
                    $(this).parents(".input-file").find('input').val('');
                });
                $(this).find('input').css("cursor","pointer");
                $(this).find('input').mousedown(function() {
                    $(this).parents('.input-file').prev().click();
                    return false;
                });
                return element;
            }
        }
    );
}
$(function() {
    bs_input_file();
});

</script>



{% endblock %}
